package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Setmeal;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishItemVO;
import com.sky.vo.SetmealVO;
import com.sky.vo.ShoppingParamVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealMapper {

    /**
     * 根据分类id查询套餐的数量
     * @param id
     * @return
     */
    @Select("select count(id) from setmeal where category_id = #{categoryId}")
    Integer countByCategoryId(Long id);

    Page<SetmealVO> findPage(SetmealPageQueryDTO pageQuery);
    @AutoFill(OperationType.INSERT)
    int insertService(Setmeal setmeal);


    void insertSetmealDish(List<SetmealDish> setmealDishes);


    int selectStatusById(List<Integer> ids);

    void deleteByIds(List<Integer> ids);

   @AutoFill(OperationType.UPDATE)
    void updateSetmeal(Setmeal setmeal);

    SetmealVO findById(Long id);


    @Select("select name,price amount,image from setmeal where id = #{setmealId}")
    ShoppingParamVO findByIds(Long setmealId);

    void deleteSetmealDishById(Long id);

    /*List<DishVO> listDishByCategoryById(Long categoryId);*/

    List<Setmeal> selectSetmealByCategoryId(String categoryId);

    List<DishItemVO> selectDishById(Long id);
}
